package com.qf.mvc01.ex;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

/*@ControllerAdvice */ //代表当前类作为为统一异常处理器
public class MyAnotationExHandler {

    @ExceptionHandler(UserException.class) //代表当前方法要处理UserException
    public String userExHandler(UserException e){

        System.out.println(e);

        return "/error/error02.html";
    }

    @ExceptionHandler(Exception.class)
    public  String exHandler(Exception e){
        e.printStackTrace();
        System.out.println(e);
        return "/error/error01.html";
    }
}
